package com.zuipin.service;

import java.lang.reflect.InvocationTargetException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.zuipin.entity.OrderDetail;
import com.zuipin.entity.OrderInfo;
import com.zuipin.entity.product.ProductInfo;
import com.zuipin.framework.exception.CustomException;
import com.zuipin.framework.result.Result;
import com.zuipin.vo.BackOrderResultVo;
import com.zuipin.vo.BackOrderVo;
import com.zuipin.vo.CalculateInfoVo;
import com.zuipin.vo.CalculateResultVo;
import com.zuipin.vo.CloseOrderPrompt;
import com.zuipin.vo.CommentProductVo;
import com.zuipin.vo.OrderConsigneeVo;
import com.zuipin.vo.OrderInfoVo;
import com.zuipin.vo.OrderSerachVo;

public interface IOrderService {
	// public void updateOrderStatus(String orderNo, Integer status, Long memberId, String updateInfo, Integer memberOrSystem, String ip);
	
	public Result<Map<String, Object>> confimReceipt(Long memberId, Long sysId, Long sysUserId, String orderNo, String ip, Result<Map<String, Object>> result, String remark)
			throws CustomException;
	
	public Result modityOrder(OrderInfoVo newOrderInfo, OrderConsigneeVo newConsignee, Long updateId, String ip, Result res) throws CustomException;
	
	public List<Map<String, Object>> findOrderInfoListByPage(OrderInfoVo orderInfo);
	
	public Result updateOrderToPackOrDelivered(String orderNo, String status, Long sysUserId, String ip, Result res);
	
	public Result auditOrder(String orderNo, Long sysUserId, String ip, Result res) throws CustomException;
	
	public Map<String, Object> backOrderList(OrderSerachVo OrderSerachVo);
	
	public Map<String, Object> preOrderList(String orderStatus, Long memberId, Long systemId, int pageNumber, int pageSize, String device);
	
	public Map<String, Integer> findStatusNum(Long memberId, Long systemId);
	
	public JSONObject orderProductList(Long orderId, String device, Long memberId) throws CustomException;
	
	public Result getOrderAndPayInfoByOrderNo(String orderNo, Integer delYes, Long memberId);
	
	public Result closeOrder(String orderNo, Long sysUserId, String closeReason) throws CustomException;
	
	public List<Map<String, Object>> canCancelOrder();
	
	Result cancelOrder(Long payId, Long sysUserId, Long memberId, String ip, Result result, String cancelReason) throws CustomException;
	
	public Result findOrderLog(String orderNo);
	
	public Result getOrderByIds(String ids);
	
	public OrderInfo findOrderInfoById(Long orderId);
	
	public Map<String, Object> getOrderStatus(String data);
	
	public Map<String, Object> getMemberTotal(String data) throws CustomException;
	
	public Map<String, Object> getDisbOrderInfo(String data) throws ParseException;
	
	/**
	 * @throws InvocationTargetException 
	 * @throws IllegalAccessException 
	 * @throws CustomException 
	 * @throws ParseException  
	 *
	 * @Title: submitBackOrder 
	 * @author: wuyicheng
	 * @date: 2017年6月12日下午5:36:10 
	 * @param backPayOrderVO
	 * @return: Result<Map<String, Object>>
	 * @throws 
	 */
	public Result<BackOrderResultVo> submitBackOrder(BackOrderVo backPayOrderVO) throws ParseException, CustomException, IllegalAccessException, InvocationTargetException;
	
	public Result getOrderByNos(String orderNos);
	
	/**
	 * @throws CustomException  
	 *
	 * @Title: toSettleByBack 
	 * @author: wuyicheng
	 * @date: 2017年6月15日下午6:17:25 
	 * @param calculateInfoVo
	 * @return
	 * @return: Result<CalculateResultVo>
	 * @throws 
	 */
	public Result<CalculateResultVo> toSettleByBack(CalculateInfoVo calculateInfoVo) throws CustomException;
	
	/**
	 * 
	 *
	 * @Title: findCanComfimReceiptOrder 
	 * @author: wuyicheng
	 * @date: 2017年6月19日下午6:30:38 
	 * @param sysId
	 * @return
	 * @return: List<Map<String,Object>>
	 * @throws
	 */
	public List<Map<String, Object>> findCanComfimReceiptOrder(Long sysId);
	
	public List<CommentProductVo> orderProduct(Long orderId, Long memberId, String device, Long id);
	
	public void modityIsComment(Long orderId) throws CustomException;
	
	public boolean isComment(Long orderId) throws CustomException;
	
	/** 
	 * 统计商品购买订单数量 
	 * 
	 * @Title: countBuyOrderByProSku 
	 * @author: wuyicheng
	 * @date: 2017年7月13日下午7:56:09 
	 * @param memberId 会员ID
	 * @param sysId 系统ID
	 * @param proSku 商品SKU
	 * @param startTime 特价规则开始时间
	 * @param endTime 特价规则截至之间
	 * @return
	 * @return: int
	 * @throws 
	 */
	public int countBuyOrderByProSku(Long memberId, Long sysId, String proSku, String startTime, String endTime);
	
	public List<OrderDetail> findOrderProductById(Long orderId, Long memberId, String device, Long sysId);
	
	public Result<CloseOrderPrompt> dealClosePrompt(String orderNo);
	
	/**
	 * 发送商品信息给库存系统
	 * @Title: createSendProductInfo 
	 * @Description: TODO
	 * @author xujinding
	 * @param @param product
	 * @param @return
	 * @return String
	 * @throws
	 */
	public String createSendProductInfo(ProductInfo product);
	
	/**
	 * 根据发票id查询订单 
	 * @Title: findOrderInfoByInvoiceId 
	 * @Description: TODO
	 * @author xujinding
	 * @param @param invoiceId
	 * @param @return
	 * @return OrderInfo
	 * @throws
	 */
	public OrderInfo findOrderInfoByInvoiceId(Long invoiceId);
}
